package at.fhooe.stefanirndorfer.walls;

import java.util.ArrayList;
import java.util.List;


public class GeometryManager {

List<Wall> walls;
	
	public GeometryManager(){
		walls = new ArrayList<Wall>();
	}
	
	public synchronized Wall checkCollisions(double x, double y){
		for(Wall w : walls){
			if(w.getWallCollider().hasCollision(x, y)){
				return w;
			}
		}
		return null;
	} 
	
	public synchronized void addWall(Wall w){
		System.out.println("Wall registred!");
		walls.add(w);
	}
	
	public synchronized void removeWall(Wall w){
		for(int i = 0; i < walls.size(); i++){
			if(walls.get(i).getId().equals(w.getId())){
				walls.remove(i);
				break;
			}
		}
	}
}
